package com.jiakai.cashinterfacemucon.service.impl;


import com.jiakai.cashinterfacemucon.dao.RelationMapper;
import com.jiakai.cashinterfacemucon.model.Relation;
import com.jiakai.cashinterfacemucon.service.RelationService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 实际的操作类但是方法并不对外开放
 *
 *
 */
public abstract class RelationServiceImpl  {
    private String the3rd;

    public RelationServiceImpl(String the3rd) {
        super();
        this.the3rd = the3rd;
    }

    @Autowired
    protected RelationMapper relationMapper;


    protected int deleteByProductID(String productID) {
        return relationMapper.deleteByProductID(productID,this.the3rd);
    }

    protected List<Relation> selectByProductID(String productID) {
        return relationMapper.selectByProductID(productID,this.the3rd);
    }

    protected int insertRelation(String productID, String PID3rd){
        return relationMapper.insertRelation(productID,PID3rd,this.the3rd);
    }

    protected int deleteByPrimaryKey(Long id) {
        return relationMapper.deleteByPrimaryKey(id);
    }

    protected int insert(Relation record) {
        record.setThe3rd(this.the3rd);
        return relationMapper.insert(record);
    }

    protected int insertSelective(Relation record) {
        record.setThe3rd(this.the3rd);
        return relationMapper.insert(record);
    }

    protected Relation selectByPrimaryKey(Long id) {
        return relationMapper.selectByPrimaryKey(id);
    }

    protected int updateByPrimaryKeySelective(Relation record) {
        record.setThe3rd(this.the3rd);
        return relationMapper.updateByPrimaryKeySelective(record);
    }

    protected int updateByPrimaryKey(Relation record) {
        return relationMapper.updateByPrimaryKey(record);
    }
}
